package edu.mju.route.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import edu.mju.route.entity.Spot;
import edu.mju.route.service.SpotService;
import edu.mju.serviceutils.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author CBL
 * @since 2020-12-30
 */
@RestController
@RequestMapping("/route/spot")
public class SpotController {

    @Autowired
    private SpotService spotService;

    /**
     * 根据线路id查找所有景点
     * @param routeId 线路id
     * @return 自定义结果集
     */
    @GetMapping("/getRouteSpot/{page}/{size}/{routeId}")
    public ResponseCode getRouteSpot(
            @PathVariable Long page,
            @PathVariable Long size,
            @PathVariable Integer routeId){
        Map<String,Object> map = spotService.getRouteSpot(page,size,routeId);
        return ResponseCode.success().data(map);
    }
}

